
var form_onBeforeLoad = function(param)
{
	jQuery(this).datagrid('options').url =__AB_PDoremi_SurveyManager_BuildUrl() ;
};

var grid_load_done = function()	{

}

function __AB_PDoremi_SurveyManager_BuildUrl(){
	var url=link_url; 
	var options=jQuery("#test_grid").datagrid("options");
	url+="&page="+options.pageNumber+"&pageSize="+options.pageSize;
	return url;
}

function __Survey_Manager_Add()
{
	var url="/index.php?module=surveymodule&action=survey_edit&src="+__FormHelper_GetSrc();
	window.location=url;
}
function __Survey_Manager_Edit(table_selector){

	var node = $('#'+table_selector).datagrid('getSelected');
	if (node){
		var url="/index.php?module=surveymodule&action=survey_edit&id="+node.id+"&cat_id="+id_cat;

		window.location=url;
	}
	// 
}
var form_onBeforeLoad = function(param)
{
	jQuery(this).datagrid('options').url;
};
function __Survey_Manage_Switch(table_selector, way){
	var node = $('#'+table_selector).datagrid('getSelected');
	if (node){
		jQuery.post("/index.php", {
			module: 'surveymodule',
			action: 'survey_rankSwitch',
			ajax_action: '1',
			id: node.id,
			stype:way

		}, function(data){
			jQuery('#test_grid').datagrid('reload');

		});
	}
}
function __Survey_Manage_Remove(table_selector){
	var msg = "Bạn có chắc muốn xóa survey này không?";
	if(!confirm(msg)) return;
	var temp=Math.random()*9999;
	var node = $('#'+table_selector).datagrid('getSelected');
	if (node){
		jQuery.post("/index.php", {
			module: 'surveymodule',
			action: 'survey_del',
			ajax_action: '1',
			id: node.id,
			t: temp
		},
		function(param)
		{
			jQuery('#test_grid').datagrid('reload');
		}
		);
		jQuery('#test_grid').datagrid('clearSelections');

	}

}
function __Survey_QuestionBy_Survey_Click(table_selector)
{
	var node = $('#'+table_selector).datagrid('getSelected');
	if(node!='')
		{
		var url = '/index.php?module=surveymodule&action=view_question_by_sur&id_sur='+node.id;
		window.location = url;   
	}
}